home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / c / quad / RCS / Quad_AddUnsLong.c,v < prev    next >
Encoding:
Text File  |  1991-03-18  |  1.7 KB  |  80 lines

  1. head     1.1;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.1
  10. date     91.03.18.12.19.06;  author kupfer;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @Add an unsigned long to an unsigned quad.
  17. @
  18.  
  19.  
  20.  
  21. 1.1
  22. log
  23. @Initial revision
  24. @
  25. text
  26. @/* 
  27.  * Quad_AddUnsLong.c --
  28.  *
  29.  *    Quad_AddUnsLong libc routine.
  30.  *
  31.  * Copyright 1991 Regents of the University of California
  32.  * Permission to use, copy, modify, and distribute this
  33.  * software and its documentation for any purpose and without
  34.  * fee is hereby granted, provided that this copyright
  35.  * notice appears in all copies.  The University of California
  36.  * makes no representations about the suitability of this
  37.  * software for any purpose.  It is provided "as is" without
  38.  * express or implied warranty.
  39.  */
  40.  
  41. #ifndef lint
  42. static char rcsid[] = "$Header: /sprite/lib/forms/RCS/proto.c,v 1.5 91/02/09 13:24:44 ouster Exp $ SPRITE (Berkeley)";
  43. #endif /* not lint */
  44.  
  45. #include <quad.h>
  46.  
  47.  
  48. /*
  49.  *----------------------------------------------------------------------
  50.  *
  51.  * Quad_AddUnsLong --
  52.  *
  53.  *    Add an unsigned long to an unsigned quad.
  54.  *
  55.  * Results:
  56.  *    The sum of the two values.
  57.  *
  58.  * Side effects:
  59.  *    None.
  60.  *
  61.  *----------------------------------------------------------------------
  62.  */
  63.  
  64. void
  65. Quad_AddUnsLong(uQuad, uLong, resultPtr)
  66.     u_quad uQuad;        /* in */
  67.     u_long uLong;        /* in */
  68.     u_quad *resultPtr;        /* out */
  69. {
  70.     unsigned long newLeastSig;
  71.  
  72.     newLeastSig = uQuad.val[QUAD_LEAST_SIG] + uLong; 
  73.     resultPtr->val[QUAD_MOST_SIG] = uQuad.val[QUAD_MOST_SIG];
  74.     if (newLeastSig < uQuad.val[QUAD_LEAST_SIG] && newLeastSig < uLong) { 
  75.     resultPtr->val[QUAD_MOST_SIG]++; 
  76.     } 
  77.     resultPtr->val[QUAD_LEAST_SIG] = newLeastSig; 
  78. }
  79. @
  80.